package com.zzh.ssi.frame.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * 普通java 中获取spring 配置ben 的公用类  ，
 * 必须在spring中配置给类，且不能延迟加载
 * Date: 2011-11-7
 * Time: 16:34:18
 */
public class SpringUtil implements ApplicationContextAware {
    private static ApplicationContext applicationContext;
//    @Override
    public void setApplicationContext(ApplicationContext context)
            throws BeansException {
     
        this.applicationContext = context;
    }

    public static Object getBean(String name) {
        return applicationContext.getBean(name);
    }
}
